<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        queueMicrotask(() => {
            console.log('任务')
        })

        const obs = MutationObserver(() => {
            console.log('任务')
        })
        obs.observe(document.body, { childList: true })
        document.body.textContent = '1'   //这个时候就会执行任务，打印’任务‘
    </script>

</body>

</html>